package simplyrugby.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import simplyrugby.entity.Team;
import simplyrugby.mapper.TeamMapper;
import simplyrugby.service.TeamService;

/**
* @author admin
* @description 针对表【team】的数据库操作Service实现
* @createDate 2025-03-31 17:25:12
*/
@Service
public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team>
    implements TeamService{

    @Override
    public Page<Team> list(Integer pageNum, Integer pageSize, Team team) {
        LambdaQueryWrapper<Team> wrapper = Wrappers.lambdaQuery(Team.class)
                .eq(!ObjectUtils.isEmpty(team.getId()), Team::getId, team.getId())
                .like(!ObjectUtils.isEmpty(team.getName()), Team::getName, team.getName());

        Page<Team> page = new Page<>(pageNum, pageSize);
        this.page(page, wrapper);
        return page;
    }
}




